package cn.zzuli.myapplication;

import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;

import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.text.Editable;
import android.view.View;
import android.widget.EditText;
public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
    }
    public void click(View view) {
        EditText username = findViewById(R.id.username);
        String s = username.getText().toString();
        EditText pwd = findViewById(R.id.pwd);
        String p = pwd.getText().toString();
        if(s.equals("fjx")&&p.equals("fjx")) {
            AlertDialog dialog2 =new AlertDialog.Builder(this).setTitle("信息提示框")
                    .setMessage("登录成功")
                    .setPositiveButton("确定", new DialogInterface.OnClickListener() {
                        @Override
                        public void onClick(DialogInterface dialog, int which) {
                        }
                    })
                    .create();
            dialog2.show();
        }else{
            AlertDialog dialog2 =new AlertDialog.Builder(this).setTitle("信息提示框")
                    .setMessage("账号或密码错误")
                    .setPositiveButton("确定", new DialogInterface.OnClickListener() {
                        @Override
                        public void onClick(DialogInterface dialog, int which) {
                        }
                    })
                    .create();
            dialog2.show();
        }
    }

   

}